package API.Scanner;

import java.util.Scanner;

public class Demo04ScannerMax {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入第一个数字：");
        int n1 = sc.nextInt();
        System.out.println("请输入第二个数字：");
        int n2 = sc.nextInt();
        System.out.println("请输入第三个数字：");
        int n3 = sc.nextInt();
        //int max = max(n1, n2, n3);
        //System.out.println("最大值是："+max);
        //第二种方法：
        int temp = n1>n2 ? n1:n2;
        int max = temp>n3 ? temp:n3;
        System.out.println("最大值是："+max);
    }
    /*public static int max(int n1,int n2,int n3){
        if(n1>n2){
            if(n1>n3){
                return n1;
            }
            else {
                return n3;
            }
        }else {
            if(n2>n3){
                return n2;
            }else {
                return n3;
            }
        }
    }*/
}
